﻿@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_Form.cshtml";
}
<script>
    var keyValue = $.request("keyValue");
    var parentId = $.request("parentId");
    $(function () {
        initControl();
        if (!!keyValue) {
            $.ajax({
                url: "/SystemManage/SysModule/GetFormJson",
                data: { keyValue: keyValue },
                dataType: "json",
                async: false,
                success: function (data) {
                    $("#form1").formSerialize(data);
                }
            });
        } else {
            $("#ParentId").val(parentId).trigger("change"); //默认选中
            $("#SortCode").val("10");
        }
    });
    function initControl() {
        $("#Target").select2({
            minimumResultsForSearch: -1
        });
        $("#ParentId").bindSelect({
            url: "/SystemManage/SysModule/GetTreeSelectJson"
        });
    }
    function submitForm() {
        if (!$('#form1').formValid()) {
            return false;
        }
        var submitUrl = "Insert";
        if (!!keyValue) {
            submitUrl = "Update";
        }
        $.submitForm({
            url: "/SystemManage/SysModule/" + submitUrl + "?keyValue=" + keyValue,
            param: $("#form1").formSerialize(),
            success: function () {
                $.currentWindow().$("#gridList").resetSelection();
                $.currentWindow().$("#gridList").trigger("reloadGrid");
            }
        });
        return false;
    }
</script>
<form id="form1">
    <div style="margin-top: 10px; margin-left: 10px; margin-right: 10px;">
        <ul class="nav nav-tabs">
            <li class="active">
                <a href="#home" data-toggle="tab">基本信息</a>
            </li>
            <li><a href="#extend" data-toggle="tab">扩展信息</a></li>
        </ul>
        <div class="tab-pane fade in active" id="home">
            <table class="form">
                <tr>
                    <th class="formTitle">上级</th>
                    <td class="formValue Value">
                        <select id="ParentId" name="Parentid" class="form-control required">
                            <option value="0">父节点</option>
                        </select>
                    </td>
                    <th class="formTitle">名称</th>
                    <td class="formValue Value">
                        <input id="FullName" name="FullName" type="text" class="form-control required" placeholder="请输入名称" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">连接</th>
                    <td class="formValue Value">
                        <input id="UrlAddress" name="UrlAddress" type="text" class="form-control" />
                    </td>
                    <th class="formTitle">目标</th>
                    <td class="formValue Value">
                        <select id="Target" name="Target" class="form-control required">
                            <option value="">请选择</option>
                            <option value="expand" title="expand">导航栏</option>
                            @*<option value="expand" title="expand">无页面</option>*@
                            <option value="iframe" title="iframe">框架页</option>
                            @*<option value="open" title="open">弹出页</option>
                                <option value="blank" title="blank">新窗口</option>*@
                        </select>
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">图标</th>
                    <td class="formValue Value">
                        <div class="input-group">
                            <input id="Icon" name="Icon" type="text" class="form-control">
                            <span class="input-group-btn">
                                <a class="btn  btn-primary"><i class="fa fa-ellipsis-h"></i></a>
                            </span>
                        </div>
                    </td>
                    <th class="formTitle">排序</th>
                    <td class="formValue Value">
                        <input id="SortCode" name="SortCode" type="text" class="form-control required" placeholder="请输入排序" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle" style="height: 35px;">选项</th>
                    <td class="formValue Value" colspan="3" style="padding-top: 1px;">
                        @* <div class="ckbox">
                                 <input id="IsMenu" name="IsMenu" type="checkbox"><label for="IsMenu">菜单</label>
                             </div>
                            <div class="ckbox">
                                 <input id="IsPublic" name="IsPublic" type="checkbox"><label for="IsPublic">公共</label>
                             </div>
                             <div class="ckbox">
                                 <input id="IsExpand" name="IsExpand" type="checkbox"><label for="IsExpand">展开</label>
                             </div>*@
                        <div class="ckbox">
                            <input id="EnabledMark" name="EnabledMark" type="checkbox" checked="checked"><label for="EnabledMark">有效</label>
                        </div>
                        @*<div class="ckbox">
                                <input id="AllowEdit" Name="AllowEdit" type="checkbox"><label for="AllowEdit">允许编辑</label>
                            </div>
                            <div class="ckbox">
                                <input id="AllowDelete" Name="AllowDelete" type="checkbox"><label for="AllowDelete">允许删除</label>
                            </div>*@
                    </td>
                </tr>
                <tr>
                    <th class="formTitle" valign="top" style="padding-top: 5px;">
                        介绍
                    </th>
                    <td class="formValue Value" colspan="3">
                        <textarea id="Description" name="Descriptions" class="form-control" style="height: 100px;"></textarea>
                    </td>
                </tr>
            </table>
        </div>
        <div class="tab-pane fade" id="extend">
            扩展信息

        </div>
    </div>
</form>
